import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;


public class HeaderSocket extends Thread {
	String hostName;
	int portNumber;
	Socket destinationForHeader;
	int TypeOfMessage;
	int PixelsInPicture;
	int PictureWidth;

	public HeaderSocket(String hostName, int portNumber, int TypeOfMessage, int PixelsInPicture, int PictureWidth) {
		this.hostName = hostName;
		this.portNumber = portNumber;
		this.TypeOfMessage = TypeOfMessage;
		this.PixelsInPicture = PixelsInPicture;
		this.PictureWidth = PictureWidth;
	}
	
	public void run() {
		try {
			System.out.println("host name in header: " + hostName);
			System.out.println("Port number in header: " + portNumber);
			System.out.println("Pixels number in the header is : " + PixelsInPicture);
			System.out.println("Picture Height is : " + PictureWidth);
			
			destinationForHeader = new Socket(hostName, portNumber);
			DataOutputStream dos = new DataOutputStream(destinationForHeader.getOutputStream());
			dos.writeInt(TypeOfMessage);
			dos.writeInt(PixelsInPicture);
			dos.writeInt(PictureWidth);
			dos.flush();			
			destinationForHeader.close();
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}